<% %>
<h1><%='Authorize for project & user'.t%></h1>
<%= form_remote_tag :url=>{:action=>'list'},
					:loading =>"Element.show('indicator')",
					:complete=>"Element.hide('indicator')",
					:success=>"alert('#{'Authorization Save Success!'.t}')"
%>
<table width=100%>
<tr>
<td colspan=3>
<%='Project'.t%>:
</td>
</tr>
<tr><td>
<select onchange="window.open('/authorize/list/' + this.options[this.selectedIndex].value,'_top')">
<option><%='Select Project'.t%></option>
<%=options_from_collection_for_select(session[:user].company.active_projects,:id,:name,@p_id)%>
</select>
</td><td>
<input type=submit value=<%='"Save Authorization"'.t%> id="submit_tag" onclick="check('employee');check('manager')" <%=params[:id].nil? ? "disabled":""%>
</td>
<td width=20%>
  <span id='indicator' style="display:none">
    <%=image_tag "indicator.gif",:border=>0%>
  </span>
</td> 
</tr>
</table>
<%if params[:id] != nil%>
<table width=100% class=data>
<tr>
  <Td width=25%> <%='User avaliable'.t%>:</td>
  <Td width=15%> </td>
  <Td width=25%> <%='Employee of'.t%> <font color=darkblue><%=Project.find(params[:id]).name%></font></td>
  <Td width=15%> </td>
  <Td width=25%> <%='Manager of'.t%> <font color=darkblue><%=Project.find(params[:id]).name%></font></td>
</tr>
<tr>
  <Td>
     <select id="user" size=20 width=100 multiple style="width:125">
	  <%=options_from_collection_for_select(@a_users,:id,:username)%>
	 </select>
  </td>
  <Td>
    <input type="button" value="&gt;&gt;" onclick="Button_OnClick('user','employee')"><br><br>
	<input type="button" value="&lt;&lt;" name="LeftButton" onclick="Button_OnClick('employee','user')">
  </td>
  <Td>
     <select id=employee name="employees[]" multiple size=20 style="width:125">
	  <%=options_from_collection_for_select(@employees,:id,:username)%>
	 </select>
  </td>
  <Td>
    <input type="button" value="&gt;&gt;" name="RightButton" onclick="Button_OnClick('employee','manager')"><br><br>
	<input type="button" value="&lt;&lt;" name="LeftButton" onclick="Button_OnClick('manager','employee')">
  </td>
  <Td>
     <select id=manager name="managers[]" style="width:125" multiple size=20>
	  <%=options_from_collection_for_select(@managers,:id,:username)%>
	 </select>
</tr>
</table>
<%end%>
<%=end_form_tag%>
